import React from 'react';
import { BrowserRouter as Router, Route, Routes } from 'react-router-dom';
import Login from './components/Login';  // 从 components 目录导入 Login
import Register from './components/Register';  // 从 components 目录导入 Register
import UserHome from './pages/UserHome';
import AdminDashboard from './pages/AdminDashboard';
import MerchantDashboard from './pages/MerchantDashboard';
import PrivateRoute from './components/PrivateRoute';

const App = () => {
  return (
    <Router>
      <Routes>
        <Route exact path="/" element={<Login />} />  {/* 首页路由 */}
        <Route path="/login" element={<Login />} />  {/* 登录路由 */}
        <Route path="/register" element={<Register />} />  {/* 注册路由 */}
        <Route path="/home" element={<UserHome />} />  {/* 用户首页路由 */}
        <Route path="/admin" element={<AdminDashboard />} />
        <Route path="/merchant" element={<MerchantDashboard />} />
      </Routes>
     </Router>
  );
};

export default App;

